<?php
// +----------------------------------------------------------------------
// | HkCms
// +----------------------------------------------------------------------
// | Copyright (c) 2012-2019 http://www.hkcms.cn, All rights reserved.
// +----------------------------------------------------------------------
// | Author: 广州恒企教育科技有限公司 <admin@hkcms.cn>
// +----------------------------------------------------------------------

namespace app\addons\validate;

use think\Validate;

class Addons extends Validate
{
    protected $rule = [
        'name' => ['require','regex'=>'/^[a-zA-Z][a-zA-Z0-9_]+$/i','unique'=>'Addons'],
        'sign' => 'require|unique:Addons',
        'title' => 'require',
        'version' => 'require',
        'author' => 'require',
        'description' => 'require',
        'rule_list' => 'array',
    ];

    protected $message = [
        'name.require' => '插件标识不能为空',
        'name.regex' => '插件标识只支持英文、数字、下划线！',
        'name.unique' => '该插件标识已经存在！',
        'sign.require' => '插件签名不能为空',
        'sign.unique' => '该插件签名已经存在',
        'title.require' => '插件版本不能为空',
        'author.require' => '插件作者不能为空',
        'description.in' => '插件描述不能为空',
        'rule_list.array' => '选择的行为数据格式不正确',
    ];

    protected $scene = [
        'local'  =>  ['name'],
    ];
}